from ..exts import db
from ..model import BaseModel


class User(BaseModel):  # 用户模型
    __tablename__ = 'tb_user'
    username = db.Column(db.String(64), unique=True, comment='用户名')
    password = db.Column(db.String(128), comment='密码')
    last_login = db.Column(db.DateTime, comment='上次登录时间')
    nickname = db.Column(db.String(64), comment='昵称')
    icon = db.Column(db.String(256), comment='头像路径')

    articles = db.relationship('Article', backref='user')
    notes = db.relationship('Note', backref='user')


class BlogInfo(BaseModel):  # 网站信息
    __tablename__ = 'tb_blogInfo'
    title = db.Column(db.String(64), comment='网站标题')
    subtitle = db.Column(db.String(64), comment='网站副标题')
    about_me = db.Column(db.Text, comment='关于我')
